<!--
 * @Author: your name
 * @Date: 2021-01-04 09:50:30
 * @LastEditTime: 2021-01-26 00:22:04
 * @LastEditors: Please set LastEditors
 * @Description: 页面列表
 * @FilePath: \yellow-member-admin\src\page\add-video\index.vue
-->
<template>
  <div class="page-add">
    <Breadcrumb :navList="['页面管理', '页面列表']"></Breadcrumb>
    <!-- <el-button type="primary">添加视频</el-button> -->
    <el-table :data="pageList" style="width: 100%">
      <el-table-column label="序号" type="index" width="80"></el-table-column>
      <el-table-column label="页面名称" prop="page_name" width="120">
      </el-table-column>
      <el-table-column label="页面完整路径" prop="page_path" width="250">
      </el-table-column>
      <el-table-column label="页面相对路径" prop="page_route" width="150">
      </el-table-column>
      <el-table-column label="备注">
        <template slot-scope="scope">
          {{ scope.row.page_comment ? scope.row.page_comment : "无" }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="300">
        <template slot-scope="scope">
          <el-popconfirm
            @onConfirm="delPage(scope.row.id)"
            title="确定要删除该页面吗？"
          >
            <el-button type="danger" slot="reference"> 删除 </el-button>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="+total"
      @current-change="handleCurrentChange"
      :page-size="10"
    >
    </el-pagination>
  </div>
</template>
<script>
export default {
  // name: "add-video",
  data() {
    return {
      pageList: [],
      total: "",
      isStart: 0, //是否开启
    };
  },
  created() {
    this.getPageList();
  },
  methods: {
    // 获取页面列表
    async getPageList() {
      const { code, data } = await this.$api.getPages();
      if (!code) {
        this.pageList = data;
      }
    },
    //改变状态
    changestatus(row) {
      this.$api.updateSeller(row);
    },
    //删除页面
    async delPage(page_id) {
      const { code, msg } = await this.$api.delPage({ page_id });
      if (!code) {
        this.$message.success(msg);
        this.getPageList();
      }
    },
    // 点击分页触发
    handleCurrentChange(val) {
      /*   this.getVideoList({
        page:val
      }) */
    },
  },
};
</script>
<style lang='scss' scoped>
.page-add {
  .el-tag {
    margin-top: 3px;
    margin-left: 10px;
  }
  .el-image {
    width: 100%;
  }
}
</style>